import java.util.Arrays;

// delta of values
// make sure the val set is sorted, otherwise binary search won't work
public class PLFactorMatch extends PLFactor {
	private static final long serialVersionUID = 1L;
	
	public PLFactorMatch() {
		// the last value is same as the second last, means all vals above second last  
		this(GetDefaultQuadrantSet());
	}
	
	public PLFactorMatch(float[] valSet) { 
		super(valSet);
	}	
	
	public float GetAValue() {
		return mValSet[mDist.PickIndex()];	
	}

	// give a new value, updates the distribution 
	public void Update(float value) {	
		int index = Arrays.binarySearch(mValSet,  value);		

		if (index < 0) {
			return;
		}
		
		PLLearnUtils.UpdateDistForWinner(mDist, index);		
	}		
}

